import React from 'react'
import { Modal, } from 'antd';
import {withRouter} from 'react-router-dom'
import {connect} from 'react-redux'

import { ExclamationCircleOutlined } from '@ant-design/icons';

import './header.less'
import memoryUtils from '../../utils/memoryUtils'
import storageUtils from '../../utils/storageUtils'
import {logout} from '../../redux/actions'

class Header extends React.Component{
    state=({

    })

    logout = ()=>{
        Modal.confirm({
            title: '确定退出?',
            icon: <ExclamationCircleOutlined />,
            onOk:()=> {
            this.props.logout()
            }
          })
    }
    render(){
        return (
            <div className="header">
                <div className='header-top'>
                    <span>欢迎，admin</span>
                    <a href="#" onClick={this.logout}>退出</a>
                </div>
                <div className='header-bottom'>2</div>
            </div>
        )
    }

}

export default connect(
    state =>({
        user:state.user
    }),
    {logout}
)(withRouter(Header))